package com.kb.erp.service.digi;

public class ApiResponse<T> {
    private int status;
    private Object count;
    private String msg;
    private T data;

    public ApiResponse(int status, String msg, T data, Object count) {
        this.status = status;
        this.count = count;
        this.msg = msg;
        this.data = data;
    }

    // Getters and Setters

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Object getCount() {
        return count;
    }

    public void setCount(Object count) {
        this.count = count;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    // Optional: You can also add static methods to create common response objects.
    public static <T> ApiResponse<T> success(T data) {
        return new ApiResponse<>(200, "Success", data, 0);
    }

    public static <T> ApiResponse<T> successCount(T data, Object count) {
        return new ApiResponse<>(200, "Success", data, count);
    }

    public static <T> ApiResponse<T> error(String message) {
        return new ApiResponse<>(500, message, null, 0);
    }
}
